package com.huishu.tcm.service.serviceImpl;

import com.huishu.tcm.entity.Dict;
import com.huishu.tcm.mapper.DictMapper;
import com.huishu.tcm.service.DictService;
import org.springframework.stereotype.Service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

@Service
public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements DictService {

	 /**
     * 筛选条件
     * @param v
     * @return
     */
    @Override
    public QueryWrapper<Dict> getQueryWrapper(Dict v){
        QueryWrapper<Dict> queryWrapper = new QueryWrapper<>();
        if(ObjectUtil.isEmpty(v)){
            return queryWrapper;
        }
		if(ObjectUtil.isNotEmpty(v.getId())){
        	queryWrapper.eq("id", v.getId());
        }
		if(ObjectUtil.isNotEmpty(v.getKey())){
		    queryWrapper.eq("key",v.getKey());
        }
       	return queryWrapper;
    }
}